<?php
namespace SixShop\News\Service;

// The original Model is no longer used directly by this service.
// use SixShop\News\Model\NewsCategory;

class NewsCategoryService
{
    private NewsFfiService $ffiService;

    public function __construct()
    {
        // Get the singleton instance of our FFI wrapper
        $this->ffiService = NewsFfiService::getInstance();
    }

    /**
     * 获取分类列表
     */
    public function getList($where = [], $order = ['sort' => 'asc', 'id' => 'desc'])
    {
        // The 'order' parameter is now handled inside the Go layer by default.
        // For more complex ordering, the Go service would need to be updated to parse it.
        return $this->ffiService->getCategoryList($where);
    }

    /**
     * 获取单个分类详情
     */
    public function getById($id)
    {
        return $this->ffiService->getCategoryById($id);
    }

    /**
     * 新增分类
     */
    public function create($data)
    {
        return $this->ffiService->createCategory($data);
    }

    /**
     * 编辑分类
     */
    public function update($id, $data)
    {
        return $this->ffiService->updateCategory($id, $data);
    }

    /**
     * 删除分类（软删除）
     */
    public function delete($id)
    {
        return $this->ffiService->deleteCategory($id);
    }
} 